
<%@ page import="pc.system.*,wstrader.*,wstrader.task.*" %>

<%
    Users user = Trader.getUser(request.getParameter("uid"));
	
	if (user == null || !user.Authenticated()) {
		response.sendRedirect("logon.jsp");	
		return;
	}
	wstrader.task.trade.Fixation ftask = user.trade.fixation;
	wstrader.task.trade.fixation.Contract task = user.trade.fixation.contract;
	((Tasks)ftask.getOwner()).clearFocus();
	ftask.setFocus(true);
	//ftask.forwardToChild(user.getuid());
	//Trader.window_width = "90%";	
	String view = request.getParameter("view");
	String contracts = request.getParameter("contracts");

	if (view==null) view ="0";
	if (contracts==null) contracts ="0";
	ResultSet rs;
%>

<%@include file="../header.jsp"%>

<%
	//long focused_id = task.doTask();
	//if (focused_id <= 0) focused_id = 1;
	//Record rc   = task.getRecord("purchase_contract",focused_id);
%>

<link href="style.css" rel="stylesheet" type="text/css">

<script language="javascript">
function doFilter()
{
	var form = document.formMain;
	form.action = "trade.fixation.jsp";
	form.submit();
}

function clickCardView(row)
{
	var form = document.formMain;
	form.action = "trade.fixation.contract.card.jsp";
	form.submit();	
}

function cardViewClick(row)
{
	var form = document.formMain;
	form.contracts.value = row.id;
	dblClick(row);
}
</script>
<style type="text/css">
<!--
.style3 {font-family: Arial}
.style6 {font-size: 12px}
-->
</style>
<form action="" method="post" name="formMain" id="formMain">
  <table width="100%"  border="0" cellspacing="0" cellpadding="0">
    <tr>
      <th colspan="2" align="left" scope="col"><img src="images/pricefixation.jpg" width="250" height="30"></th>
      <th width="2%" scope="col">&nbsp;</th>
      <th width="2%" scope="col">&nbsp;</th>
      <th colspan="4" scope="col"><input type="hidden" name="uid"        id="uid"       value="<%=user.getuid()%>">
        <input type="hidden" name="task_id"    id = "task_id"   value="0">
        <input name="type" type="hidden" id="type">
        <input name="contracts" type="hidden" id="contracts" value="<%=contracts%>">        </th>
    </tr>
    <tr align="left">
      <td colspan="8">
	    <table>
    <tr>
      <td width="150" align="center" bgcolor="#EEEEEE"><strong><span class="style29 style3 style6">Buyer/Seller</span></strong></td>
      <td width="150" align="center" bgcolor="#EEEEEE"><strong><span class="style29 style3 style6">Market</span></strong></td>
      <td align="center" bgcolor="#EEEEEE"><strong><span class="style29 style3 style6">Month</span></strong></td>
      <td align="center" bgcolor="#EEEEEE"><strong></strong></td>
      <td align="center" bgcolor="#EEEEEE"><strong><span class="style29 style3 style6">Contract Type </span></strong></td>
    </tr>
    <tr>
      <td height="32"><select name="buyer_seller" size="9" id="select" onChange="doFilter()" style="font-family:Arial; font-size:11px; width:150px;border:0">
        <option value="0" selected>All</option>
        <%
			task.getResponse().setOption(task.getBuyerSellerList());
			task.getResponse().setSelected("buyer_seller");
		%>
      </select>
	  </td>
      <td><select name="terminal_market" size="9" id="terminal_market" onChange="doFilter()" style="font-family:Arial; font-size:11px; width:150px;border:0">
        <option value="0" selected>All</option>
        <option value="NYC">NYC</option>
        <option value="LIFFE">LIFFE</option>
        <%task.getResponse().setSelected("terminal_market");%>
      </select>
	  </td>
      <td>
        <select name="ter_mth" size="9" id="ter_mth" onChange="doFilter()" style="font-family:Arial; font-size:11px; width:150px;border:0">
          <%@include file="include/TerminalMonthList.jsp"%>
        </select>
</td>
      <td>&nbsp;
	  </td>
      <td><select name="cnt_type" size="9" id="cnt_type" onChange="doFilter()" style="font-family:Arial; font-size:11px; width:150px;border:0">
        <option value="0" selected>All</option>
        <option value="P">PURCHASE</option>
        <option value="S">SALES</option>
        <%task.getResponse().setSelected("cnt_type");%>
      </select>
	  </td>
    </tr>
	  
	  </table>	  </td>
    </tr>
    <tr>
      <td colspan="8">	  <table width="100%"  border="1" cellspacing="1" cellpadding="1">
        <tr bordercolor="#EEEEEE">
          <td width="4%" align="center" bgcolor="#EEEEEE"><strong><span class="style29 style3 style6">&nbsp;</span></strong><strong><span class="style29 style3 style6">Id</span></strong></td>
          <td width="14%" align="center" bgcolor="#EEEEEE"><strong><span class="style29 style3 style6">&nbsp;</span></strong><strong><span class="style29 style3 style6">Cnt.Ref.No</span></strong></td>
          <td width="14%" align="center" bgcolor="#EEEEEE"><strong><span class="style29 style3 style6">&nbsp;</span></strong><strong><span class="style29 style3 style6">Brk.Ref.No</span></strong></td>
          <td width="20%" align="center" bgcolor="#EEEEEE"><strong><span class="style29 style3 style6">Buyer/Seller</span></strong><strong><span class="style29 style3 style6"></span></strong></td>
          <td width="7%" align="center" bgcolor="#EEEEEE"><strong><span class="style29 style3 style6">Market</span></strong><strong><span class="style29 style3 style6"></span></strong></td>
          <td width="6%" align="center" bgcolor="#EEEEEE"><strong><span class="style29 style3 style6">Month</span></strong><strong><span class="style29 style3 style6"></span></strong></td>
          <td width="5%" align="center" bgcolor="#EEEEEE"><strong><span class="style29 style3 style6">Bot/Sold</span></strong><strong><span class="style29 style3 style6"></span></strong></td>
          <td width="4%" align="center" bgcolor="#EEEEEE"><strong><span class="style29 style3 style6">&nbsp;</span></strong><strong><span class="style29 style3 style6">Diff</span></strong></td>
          <td width="9%" align="center" bgcolor="#EEEEEE"><strong><span class="style29 style3 style6">&nbsp;</span></strong><strong><span class="style29 style3 style6">&nbsp;Avg.Price</span></strong></td>
          <td width="7%" align="center" bgcolor="#EEEEEE"><strong><span class="style29 style3 style6">Lots Fixed </span></strong><strong><span class="style29 style3 style6">&nbsp;</span></strong></td>
          <td width="10%" align="center" bgcolor="#EEEEEE"><strong><span class="style29 style3 style6">Lots UnFixed </span></strong><strong><span class="style29 style3 style6"></span></strong></td>
        </tr>
        <tr>
          <td colspan="11">
            <div id=scroll1 style="BORDER:0px ; OVERFLOW: auto; WIDTH: 100%; HEIGHT: 260px;">
              <%@include file="trade.fixation.contract.list.details.jsp"%>
          </div></td>
        </tr>
      </table></td>
    </tr>
    <tr>
      <td width="6%">&nbsp;</td>
      <td width="23%">&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td width="1%" align="right">&nbsp;&nbsp;</td>
      <td width="43%" align="right">&nbsp;</td>
      <td width="11%" align="right">&nbsp;</td>
      <td width="12%" align="center">&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td align="right" valign="middle">&nbsp;&nbsp;</td>
      <td align="right" valign="middle">&nbsp;</td>
      <td align="center" valign="middle">&nbsp;</td>
      <td align="right" valign="middle"><img src="images/cardview.jpg" width="55" height="18" onClick="clickCardView();">&nbsp;</td>
    </tr>
  </table>
<% 
	System.out.println("View:-" + view);
	if (view.compareTo("1")==0)
	{ 
%>	  
<script>
	dblClick();
</script>
<%
	}
%>  
</form>
<%@include file="../footer.jsp"%>

